I just watched the 'Making your own modules python' I am able to create and save the module, but I am not quite sure how you got it to work. I know you created it and then used it locally. For some reason after I created it, I get that error you got when trying to use it at first. I notice you typed it on another screen and it worked. That is what I need help with, thanks.
You must be logged in to post. Please login or register an account.
I can open the example.py and I see what I created but when I type examplemod('test') nothing happens. Is it supposed to do something on another IDLE shell? I have tried that as well. Sorry if I am making this confusing. It is just hard to see what screens you are switching back from some times.
-jkinser 8 years ago
You must be logged in to post. Please login or register an account.
Unfortunately I am not following your question very well.
Basically, you can make a python script, calling it something.py. In a new python script, you can import something, and use functions from within something.py.
-Harrison 8 years ago
You must be logged in to post. Please login or register an account.
I don't understand how to create a module, store it, and use it again later. I may have to go google it and read up on it. But I will just keep moving forward on your videos and also maybe I will catch on that way later down the line. I have installed the python directory and python IDLE but it looks like you are using something else to create a module. And also I can't follow along too well with the video because I have windows 10 and you are using an older windows. You are probably asking yourself, that shouldn't matter and one should know windows regardless if they are seeking to learn code, but windows 10 isn't exactly user friendly. It is set up different.
-jkinser 8 years ago
You must be logged in to post. Please login or register an account.
You just keep the file in the local directory as the script you are writing, or you can store it in the site-packages directory of your Python installation.
When you go to import modules, Python looks locally, in the standard library, and in the 3rd party libraries area (site-packages).
So long as that module is in one of those 3 places, you can import it.
I am using IDLE to create the module.
Both versions of Windows are similar for the actions.
I think the MAIN point of confusion is more likely that your version of Python isn't installed @ C:/Python35/. In that tutorial, I was using python 3.4, which went to C:/Python34 by default...but 3.5 doesn't for some stupid reason. You have to manually change it when you are installing. I am thinking that's probably where you're having issues, unless you can't import locally either.
-Harrison 8 years ago
You must be logged in to post. Please login or register an account.
Also I need to get this clear...is a text editor different from Python shell IDLE? That is what I think is confusing me.
-jkinser 8 years ago
You must be logged in to post. Please login or register an account.
I just got to video on basics: Reading CSV files in Python. I can't go any further I just realized without understanding the whole text editor thing you are doing. Okay...I have tried going to Microsoft Word and saving : 1/2/2014,5,8,red 1/3/2014,5,2,green 1/4/2014,9,1,blue to a file named example.csv. Then in the video I see that you are typing: import csv >>> with open('example.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') for row in readCSV: print(row) print(row[0]) print(row[0],row[1],row[2],) and then opening it in the python shell. How in the world are you doing that? Is that stuff you typed, with open etc., in a shell or a text editor?
-jkinser 8 years ago
You must be logged in to post. Please login or register an account.
Okay...I think I have figured it out by doing some research. Sorry for all that.
-jkinser 8 years ago
Last edited 8 years ago
You must be logged in to post. Please login or register an account.